#include "config.h"

int main(int argc, char *argv[]) {
    key_t key = ftok(SHM_FPATH, 'a');
    int shm_id = shmget(key, sizeof(int) * 100, 0664 | IPC_CREAT);
    void *ptr = shmat(shm_id, NULL, 0);

    student_t *student = (student_t *)ptr;
    student->age = 10;
    strcpy(student->name, "Kai.Li");

    shmdt(ptr);

    printf("waiting...key: %d, shm id: %d\n", key, shm_id);
    sleep(30);
    shmctl(shm_id, IPC_RMID, NULL);
    printf("finished\n");

    return 0;
}
